﻿<custom:TabPageControl x:Class="MIXer.Views.ConfigView"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
             xmlns:custom="clr-namespace:MIXer.Customization"
             xmlns:cal="http://www.caliburnproject.org">
    
    <DockPanel LastChildFill="True">
        <Grid Margin="10 10 10 10">
            <Grid.RowDefinitions>
                <RowDefinition Height="*" />
            </Grid.RowDefinitions>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="Auto" />
                <ColumnDefinition Width="Auto" />
            </Grid.ColumnDefinitions>

            <StackPanel Orientation="Vertical" Grid.Column="0" Grid.Row="0">
                <StackPanel Orientation="Horizontal">
                    <CheckBox x:Name="UseProxy" Content="Use proxy?" Padding="5 5 5 5" VerticalContentAlignment="Center" Margin="5 5 5 5"/>
                    <CheckBox x:Name="UseDefaultProxy" Content="Use already configured system proxy? (in Internet Explorer)" Padding="5 5 5 5" VerticalContentAlignment="Center" Margin="5 5 5 5">
                        <CheckBox.Style>
                            <Style TargetType="CheckBox" BasedOn="{StaticResource {x:Type CheckBox}}">
                                <Setter Property="IsEnabled" Value="False" />
                                <Style.Triggers>
                                    <DataTrigger Binding="{Binding UseProxy}" Value="True">
                                        <Setter Property="IsEnabled" Value="True" />
                                    </DataTrigger>
                                </Style.Triggers>
                            </Style>
                        </CheckBox.Style>
                    </CheckBox>
                </StackPanel>
                <StackPanel Orientation="Horizontal">
                    <StackPanel.Style>
                        <Style TargetType="StackPanel">
                            <Setter Property="IsEnabled" Value="False" />
                            <Style.Triggers>
                                <MultiDataTrigger>
                                    <MultiDataTrigger.Conditions>
                                        <Condition Binding="{Binding UseProxy}" Value="True" />
                                        <Condition Binding="{Binding UseDefaultProxy}" Value="False" />
                                    </MultiDataTrigger.Conditions>
                                    <Setter Property="IsEnabled" Value="True" />
                                </MultiDataTrigger>
                            </Style.Triggers>
                        </Style>
                    </StackPanel.Style>
                    <TextBlock Text="Address:" VerticalAlignment="Center" Padding="5 5 5 5" Width="80" />
                    <TextBox x:Name="ProxyServer" Margin="5 5 5 5" Width="120" />
                    <TextBlock Text="Port:" VerticalAlignment="Center" Padding="5 5 5 5" Width="50" />
                    <TextBox x:Name="ProxyPort" Margin="5 5 5 5" Width="50" />
                </StackPanel>
                <StackPanel Orientation="Horizontal">
                    <StackPanel.Style>
                        <Style TargetType="StackPanel">
                            <Setter Property="IsEnabled" Value="False" />
                            <Style.Triggers>
                                <MultiDataTrigger>
                                    <MultiDataTrigger.Conditions>
                                        <Condition Binding="{Binding UseProxy}" Value="True" />
                                        <Condition Binding="{Binding UseDefaultProxy}" Value="False" />
                                    </MultiDataTrigger.Conditions>
                                    <Setter Property="IsEnabled" Value="True" />
                                </MultiDataTrigger>
                            </Style.Triggers>
                        </Style>
                    </StackPanel.Style>
                    <TextBlock Text="Username:" VerticalAlignment="Center" Padding="5 5 5 5" Width="80" />
                    <TextBox x:Name="ProxyUser" Margin="5 5 5 5" Width="120" />
                    <TextBlock Text="Password:" VerticalAlignment="Center" Padding="5 5 5 5" Width="80" />
                    <PasswordBox Margin="5 5 5 5" Width="120" cal:Message.Attach="[Event PasswordChanged] = [Action PasswordChanged($source)]" custom:PasswordHelper.Attach="True" />
                </StackPanel>
            </StackPanel>
        </Grid>
    </DockPanel>
</custom:TabPageControl>
